#ifndef KDTREE_H
#define KDTREE_H

#include "KDTreeNode.h"
#include "BoundingBox.h"

const int MAX_KD_DEPTH = 1;
const int TARGET_TRIANGLES = 1;

class KDTree
{
public:
//private:
	//Note: root node is an x-z plane (children are x-y then y-z and so on).
	KDTreeNode root;

public:
	KDTree(void);
	~KDTree(void);

	//Loads a pre-built k-d tree in from a file (triangle intersection will still be re-calculated).
	//void loadTree(char* filename);

	void buildTree(vector<Triangle> *sceneTriangles, BoundingBox sceneBox);
	void buildTree(KDTreeNode *curNode, BoundingBox curBox, Vector3 curNormal, int depth);
};

#endif